<template>
  <a-modal
    :title="title"
    :visible="visible"
    :confirm-loading="confirmLoading"
    cancel-text="关闭"
    @ok="submit"
    @cancel="closeModal"
  >
    <a-spin :spinning="confirmLoading">
      <p class="title_text">你确定要{{upDownVal}}{{name}}？</p>
      <a-form :form="form">
        <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="是否分店可用">
          <a-radio-group v-model="subUse">
            <a-radio :value="0"> 否 </a-radio>
            <a-radio :value="1"> 是 </a-radio>
          </a-radio-group>
        </a-form-item>
      </a-form>  
    </a-spin>
  </a-modal>
</template>

<script>
import { Slime } from '@/mixins/slime';
export default {
  name: 'upDownModal',
  data() {
    return {
      title: '上下架',
      form: this.$form.createForm(this),
      model:{},
      name:'', //商家
      upDownVal:'', //0下架1上架
      subUse:0, //0否 1是
      action:0,
    };
  },
  mixins: [Slime],
  methods: {
    // 详情
    open(val,name) {
      this.visible = true;
      this.action = val
      this.name = name
      if(val == 0){
        this.upDownVal = "下架"
      }else{
        this.upDownVal = "上架"
      }
    },
    // 提交
    submit() {
      this.confirmLoading = true;
      const param = {
        action: this.action,
        subUse: this.subUse,
      };
      this.submitUpdate(param);
    },
    // 提交 改
    submitUpdate(param) {
      this.confirmLoading = false;
      this.visible = false;
      this.$emit('upDownModal', param);
    },
    // 弹窗-关闭
    closeModal() {
      this.confirmLoading = false;
      this.visible = false;
      this.$emit('closeModal');
    },
  },
};
</script>

<style rel="stylesheet/scss" lang="scss" scoped>
.title_text{
  font-size: 14px;
  font-weight: 800;
  color: #000;
}
</style>